package gui;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;

/**
 * @author Ramy Refky 
 * */
public class GrouperComponentLabel extends ComponentLabel{

	private static final long serialVersionUID = 1L;

	/**
	 * Constructor initializes ComponentLabel.
	 * @param XLocation, YLocation, Width, Height
	 */
	public GrouperComponentLabel(int xLoc,int yLoc,int originalWidth, int originalHeight){
		super(xLoc,yLoc,originalWidth,originalHeight);
	}
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		

		Rectangle Box = new Rectangle();
		Box.setBounds(newWidth/2-5,newHeight/2-5,10,10);
		
    	Graphics2D g2 = (Graphics2D)g;
        g2.setPaint(Color.black);
        
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_OFF);

        g2.setStroke(new BasicStroke(4f));
        
        g2.drawLine(newWidth/2,newHeight/2+1,newWidth*4/5,newHeight/2+1);
        g2.drawLine(newWidth/2,newHeight/2,newWidth/2,newHeight/3);
        g2.drawLine(newWidth/2,newHeight/2,newWidth/2,newHeight*2/3);
        g2.drawLine(newWidth/5-2,newHeight*2/3+1,newWidth/2,newHeight*2/3+1);
        g2.drawLine(newWidth/5-2,newHeight/3,newWidth/2,newHeight/3);

        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);

        g2.setStroke(new BasicStroke(2f));
        g2.setPaint(Color.black);
        g2.draw(Box);

        if(!selected)
        	g2.setPaint(Color.white);
        else
        	g2.setPaint(Color.getHSBColor((float)0.5,(float)0.1,(float)0.9));
        Box.setBounds(newWidth/2-4,newHeight/2-4,9,9);
        
        g2.fill(Box);
        
	}
	
}
